
/**
 * @properties={typeid:24,uuid:"A895D082-7554-48F7-B2EC-2A0FF38B5E78"}
 */
function queryTotales() {
	var $tipo = ''
	if (forms.diario_compras_ds_1.fTipoProveedor != null)
	{
		$tipo = ' and p.tipo = ? '
	}
	var queryConcepto 	= 'SELECT concepto_id, SUM(cv.importe) as "total" FROM ctacte_pr_varios "cv"'+
							' JOIN ctacte_pr "cc" on cc.ctacte_pr_id = cv.ctacte_pr_id ' + 
							' JOIN proveedor as "p" ON cc.proveedor_id = p.proveedor_id '+
							' WHERE cc.fecha_presentacion between ? and ? AND cv.userv_id = ? ' + $tipo +
							' GROUP BY concepto_id'
	/** @type {Array<Object>}*/
	var argsConcepto	= [globals.gFechaDesde, globals.gFechaHasta, globals.gUservID]
	if (forms.diario_compras_ds_1.fTipoProveedor != null != null)
	{
		argsConcepto.push(forms.diario_compras_ds_1.fTipoProveedor)
	}
	var $conceptos 	= databaseManager.getDataSetByQuery('infocom',queryConcepto,argsConcepto,-1)
	if ($conceptos.getMaxRowIndex() == 0)
		return 
		
	var $frm = solutionModel.getForm('diario_compras_ds_2_conceptos')
	var tipos = [JSColumn.INTEGER, JSColumn.NUMBER]
	$frm.dataSource = $conceptos.createDataSource('DIARIO_C_CONCEPTOS',tipos)
	
	forms[$frm.name].controller.recreateUI()
}
